Skip to content

Conversation

@roomote
Copy link

@roomote roomote bot commented Oct 25, 2025

This PR attempts to address Issue #8812. Feedback and guidance are welcome.

Problem

When the model list is long enough to scroll, the pinned models at the top scroll away with the rest of the list, which defeats the purpose of pinning them for quick access.

Solution

  • Separated pinned and unpinned configs into different containers
  • Pinned configs now stay fixed at the top
  • Only unpinned configs are scrollable
  • Dynamic height calculation ensures optimal use of space

Changes

  • Modified ApiConfigSelector.tsx to render pinned items in a fixed container and unpinned items in a scrollable container
  • Added comprehensive tests to verify the fixed behavior
  • No breaking changes to existing functionality

Testing

  • All existing tests pass
  • Added two new test cases to verify:
    1. Pinned configs remain fixed at top while unpinned configs scroll
    2. All configs display in scrollable container when no configs are pinned

Fixes #8812


Important

Fixes pinned models scrolling issue by separating pinned and unpinned models into fixed and scrollable containers in ApiConfigSelector.tsx.

  • Behavior:
    • Pinned models remain fixed at the top of the list in ApiConfigSelector.tsx.
    • Unpinned models are scrollable, with dynamic height calculation for optimal space usage.
  • Testing:
    • Added tests in ApiConfigSelector.spec.tsx to verify pinned models stay fixed and unpinned models scroll.
    • Tests ensure all models are scrollable when no models are pinned.
  • Misc:
    • No breaking changes to existing functionality.

This description was created by Ellipsis for 50c8d9a. You can customize this summary. It will automatically update as commits are pushed.

- Separated pinned and unpinned configs into different containers
- Pinned configs now stay fixed at the top
- Only unpinned configs are scrollable
- Added tests to verify the fixed behavior

Fixes #8812
@roomote roomote bot requested review from cte, jr and mrubens as code owners October 25, 2025 01:16
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. bug Something isn't working labels Oct 25, 2025
@roomote
Copy link
Author

roomote bot commented Oct 25, 2025

Review Summary

I've reviewed the changes and identified 3 issues that should be addressed:

  • Fix negative maxHeight calculation when 9+ configs are pinned (line 220)
  • Replace hardcoded 36px item height with dynamic calculation (line 220)
  • Account for separator height in maxHeight calculation (lines 209-211)

Follow Along on Roo Code Cloud

style={{
maxHeight:
pinnedConfigs.length > 0
? `calc(300px - ${pinnedConfigs.length * 36}px)`
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The dynamic maxHeight calculation may yield a negative value if there are too many pinned configs. Consider adding a guard to prevent negative heights.

Suggested change
? `calc(300px - ${pinnedConfigs.length * 36}px)`
? `calc(300px - ${Math.max(0, pinnedConfigs.length * 36)}px)`

This comment was generated because it violated a code review rule: irule_JHt4LrVpts9BYI6Q.

style={{
maxHeight:
pinnedConfigs.length > 0
? `calc(300px - ${pinnedConfigs.length * 36}px)`
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The maxHeight calculation can produce negative values when 9 or more configs are pinned. For example, with 9 pinned configs: calc(300px - 324px) = -24px, which will hide the scrollable container entirely. This happens when users pin many configs or when a search query returns multiple pinned results. Consider adding a minimum value or dynamically calculating based on actual rendered heights.

style={{
maxHeight:
pinnedConfigs.length > 0
? `calc(300px - ${pinnedConfigs.length * 36}px)`
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded 36px assumption for each config item height is fragile. Item height can vary with different themes, font sizes, zoom levels, or accessibility settings. If the actual height differs, the scrollable area calculation will be incorrect, potentially causing either wasted space or unintended overflow. Consider using CSS flexbox with flex-basis or measuring actual rendered heights dynamically.

Comment on lines +209 to +211
{pinnedConfigs.length > 0 && unpinnedConfigs.length > 0 && (
<div className="mx-1 my-1 h-px bg-vscode-dropdown-foreground/10" />
)}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The maxHeight calculation doesn't account for the separator element's total height. The separator has class h-px (1px height) plus my-1 margins (0.25rem top and bottom, typically 4px each = 8px total), adding approximately 9px to the container. This causes the combined height of pinned configs + separator + unpinned container to exceed the intended 300px limit.

Copy link
Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review complete. I found 3 issues that should be addressed before this PR can be merged. Please see the inline comments for details.

@XiaoYingYo
Copy link

XiaoYingYo commented Oct 25, 2025

Success, looks good
@roomote

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

Pinned model options should not scroll with the model list

3 participants